import type { AppRouteRecordRaw } from '@/types/router'
import { testRoutes } from './modules/test'
import { rbacRoutes } from './modules/rbac'
import { baseDataRoutes } from './modules/baseData'
import { productRoutes } from './modules/product'

/**
 * 路由配置(从path为'/'的路由下开始截取)
 * path : 路由路径
 * redirect : 跳转路径
 * component : 路由组件
 * components : {路由组件}
 * showSubMenu : 有子路由是否在展示子菜单(不设置默认不展示)
 * children : 子路由
 * meta : 路由元信息
 * meta.title : 路由标题/菜单标题/面包屑展示标题
 * meta.authType : 访问权限(不设置默认为@) @认证 ?游客 *所有
 * meta.isMenu : 是否菜单(不设置默认不是)
 */
const routes: AppRouteRecordRaw[] = [
	{
		path: '/login',
		component: () => import('@/views/guest/Login.vue'),
		meta: {
			title: '路由.登录',
			authType: '?'
		}
	},
	{
		path: '/',
		redirect: '/site',
		meta: {
			title: '路由.首页'
		},
		children: [
			{
				path: '/site',
				component: () => import('@/views/site/Index.vue'),
				meta: {
					title: '路由.首页',
					isMenu: true
				}
			},
			...testRoutes,
			...rbacRoutes,
			...baseDataRoutes,
			...productRoutes,
			{
				path: '/:catchAll(.*)',
				component: () => import('@/views/NotFound.vue'),
				meta: {
					title: '路由.404'
				}
			}
		]
	}
]

export default routes
